package cn.tedu.api;

import java.util.Arrays;

public class Test3_String {
    public static void main(String[] args) {
        char[] c = {'h','e','l','l','o'};
        String s1 = new String(c);
        String s2 = "asdqhwkeqwe";
        String s3 = "        hello      ";
        System.out.println(s1);
        System.out.println(s2.charAt(5));
        System.out.println(s1.concat("World"));
        System.out.println(s1.endsWith("lo"));
        System.out.println(s1.equals(s3));
        System.out.println("---------------");
        System.out.println(s1.hashCode());
        System.out.println(s1.indexOf("l"));
        System.out.println(s1.lastIndexOf("l"));
        System.out.println(s1.isEmpty());
        System.out.println(s1.length());
        System.out.println("-------------------");
        System.out.println(s1.replace('l','w'));
        System.out.println(s1.startsWith("he"));
        System.out.println(s1.substring(2));
        System.out.println(s1.substring(1,3));
        System.out.println(s1.toLowerCase());
        System.out.println(s1.toUpperCase());
        System.out.println(s3.trim());//去掉多余的空格
        System.out.println("------------------");
        System.out.println(String.valueOf(10)+1);
        char[] css = s1.toCharArray();
        System.out.println(css);
        byte[] bs = s1.getBytes();
        System.out.println(Arrays.toString(bs));
        String[] ss = s2.split("q");
        System.out.println(Arrays.toString(ss));
        char[] cs2 = s2.toCharArray();
        for (int i = 0; i < cs2.length; i++) {
            System.out.println(cs2[i]);
        }
        for (int i = 0; i < s2.length(); i++) {
            System.out.println(s2.charAt(i));
        }
    }
}
